import javax.servlet.http.*;
import java.sql.*;
import java.io.*;

public class GetCompany extends HttpServlet
{
  
  public void doPost(HttpServletRequest request, HttpServletResponse response) throws IOException
  {

     try
       {
  
         response.setContentType("text/html");
         PrintWriter out=response.getWriter();


        Class.forName("oracle.jdbc.driver.OracleDriver");

         Connection con=DriverManager.getConnection("jdbc:oracle:thin:@localhost:1521:xe","pac","mca"); 

         Statement stmt=con.createStatement();
         
             ResultSet rs = stmt.executeQuery("SELECT company_name from company_register ");
             
         while(rs.next())

         {
                String str=rs.getString(1);
out.println("<option value="+str+">"+str+"</option>");  
        }
            
       
 }
         
     
 
    catch(Exception e)
       {
      PrintWriter out=response.getWriter();
         out.println("<option> error</option>");   
}   

  }

}  

 